# coding:utf-8
from django.conf.urls.defaults import *
import os.path
from vleApp.feeds import NewsFeed, Prueba
from django.contrib import admin
admin.autodiscover()

#FEEDS
feeds = {
    'news': NewsFeed,
    'prueba':Prueba
}

urlpatterns = patterns('',
    (r'^start/$', 'vle.views.start'),
    (r'^admin/(.*)$', admin.site.root),
    #feedback
    (r'^home/checkSession/$', 'vle.views.checkSession'),
    (r'^retroalimentaciones/(.*)/(.*)/eliminar/(.*)/$', 'vle.views.deleteFeedbackComment'),
    (r'^tareas/(.*)/(.*)/eliminar/(.*)/$', 'vle.views.deleteHomework'),
    #news/feeds
    (r'^createNews/(.*)/(.*)/$', 'vle.views.createNews'),
    (r'^news/(\d*)/$', 'vle.views.singleNews'),
    (r'^news/(.*)/(.*)/$', 'vle.views.news'),
    (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed',
        {'feed_dict': feeds}),
    #files/video
    (r'^uploadFile/(.*)/(.*)/$', 'vle.views.uploadFile'),
    (r'^uploadVideo/(.*)/(.*)/$', 'vle.views.uploadVideo'),
    (r'^viewVideo/(.*)/(.*)/(.+).flv/$', 'vle.views.viewVideo'),
    (r'^viewVideoMenu/(.*)/(.*)/$', 'vle.views.viewVideoMenu'),
    (r'^tareas/(.*)/(.*)/$', 'vle.views.sendHomework'),
    (r'^fileMenu/(.*)/(.*)/$', 'vle.views.fileMenu'),
    (r'^downloadFile/(.*)/(.+)/$','vle.views.downloadFile'),
    (r'^subirTemario/(.*)/(.*)/$', 'vle.views.uploadSyllabus'),
    (r'^subirCalificaciones/(.*)/(.*)/$', 'vle.views.uploadGrades'),
    (r'^deleteFile/(.*)/(.*)/(.*)/$', 'vle.views.deleteFile'),
    (r'^deleteVideo/(.*)/(.*)/(.*)/$', 'vle.views.deleteVideo'),
    (r'^retro/(.*)/(.*)/$', 'vle.views.retroGeneral'),
    (r'^retroalimentaciones/(.*)/(.*)/$', 'vle.views.feedbackEdit'),
    # MIDP
    (r'^loginMobile/$', 'vle.views.loginMobile'),
    (r'^listVideos/$', 'vle.views.listVideos'),
    (r'^listGroups/$', 'vle.views.listGroups'),
    (r'^listThreads/$', 'vle.views.listThreads'),
    (r'^listPosts/$', 'vle.views.listPosts'),
    #registration
    (r'^registrar_alumno/$', 'vle.views.register'),
    (r'^registrarMaestro/$', 'vle.views.teacherRegistration'),
    (r'^registrarGrupo/$', 'vle.views.registerGroup'),
    #login
    (r'^login/$', 'vle.views.userLogin'),
    (r'^accounts/login/$', 'vle.views.userLogin'),
    #logout
    (r'^logout/$', 'vle.views.userLogout'),
       
    (r'^crearTema/(.*)/(.*)/$', 'vle.views.createThread'),
    (r'^verCursos/$', 'vle.views.viewCourses'),
    (r'^course/(.*)/(.*)/$', 'vle.views.courseHome'),
    (r'^temario/(.*)/(.*)/$', 'vle.views.courseSyllabus'),
    (r'^calificaciones/(.*)/(.*)/$', 'vle.views.grades'),
    (r'^forum/(.*)/(.*)/$', 'vle.views.showThreads'),
    (r'^editarPreferencias/(.*)/(.*)/$', 'vle.views.editPreferences'),
    (r'^post/(.*)/$', 'vle.views.makePost'),#puede recibir otro
    (r'^thread/(.+)/$', 'vle.views.showPosts'),
    (r'^vote/(\d+)/(\d+)/(\w+)/$', 'vle.views.votePost'),
    (r'^editGroup/(.*)/(.*)/$', 'vle.views.editGroup'),
    
    #otros
    (r'^alumnos/(.*)/(.*)/$', 'vle.views.viewStudentsInGroup'),
    (r'^home/$', 'vle.views.home'),
    (r'^editTeacherProfile/$','vle.views.editTeacherProfile'),
    (r'^teacher/(\d+)/$','vle.views.teacherProfile'),
    (r'^editStudentProfile/$','vle.views.editStudentProfile'),
    (r'^permissionDenied/$', 'vle.views.permissionDenied'),

    #admin
    (r'^viewAllCourses/$','vle.views.viewAllCourses'),
    (r'^viewAllStudents/(\d+)/(.*)/$','vle.views.viewAllStudents'),
    (r'^viewAllTeachers/(\d+)/(.*)/$','vle.views.viewAllTeachers'),

    #static
    (r'^(?P<path>.*)$','django.views.static.serve',
		{'document_root': os.path.join(os.path.dirname(__file__), 'static').replace('\\','/')}),
    # Example:
    # (r'^vle/', include('vle.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # (r'^admin/(.*)', admin.site.root),
)
